package com.qf.service;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.qf.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

/**
 * @author 千锋健哥
 */
@Service
public class ServiceAImpl implements ServiceA{

    @Autowired
    private UserDao userDao;

    @Autowired
    private RestTemplate restTemplate;

    @Override
    @Transactional
    @LcnTransaction
    public String desc() {
        //1. a账户扣款
        userDao.update();
        //2. b账户加款项
        String str = restTemplate.getForObject("http://localhost:8081/b/add", String.class);
        return str;
    }

}
